home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / mc302emb.zip / LIBCF / CONCAT.ASM < prev    next >
Assembly Source File  |  1994-03-18  |  799b  |  33 lines

  1. *
  2. * Concatinate several strings: register concat(dest, source, ...)
  3. *
  4. concat    ST    ?temp        Save argument count
  5.     MULB    #2        Word entries
  6.     LEAI    ,S        Point to stack
  7.     ADAI            Adjust
  8.     PUSHI            Save argument pointer
  9.     LDI    I        Get output pointer
  10.     PUSHI            Save output pointer
  11. ?1    LD    ?temp        Get arg count
  12.     DEC            Reduce count
  13.     ST    ?temp        And resave
  14.     SJZ    ?3        End of count
  15.     LD    2,S        Get argument pointer
  16.     DEC            Backup
  17.     DEC            Backup
  18.     ST    2,S        Resave argument pointer
  19.     TAI            Point to it
  20.     LDI    I        Get source pointer
  21. ?2    LDB    I        Get byte from source
  22.     SJZ    ?1        Zero, get next
  23.     PUSHI            Save input pointer
  24.     LDI    2,S        Get output pointer
  25.     STB    I        Write to output
  26.     LEAI    1,I        Advance
  27.     STI    2,S        Resave
  28.     LDI    S+        Restore input pointer
  29.     LEAI    1,I        Advance to next
  30.     SJMP    ?2        And proceed
  31. ?3    FREE    4        Release stack
  32.     RET
  33.